<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin extends FMIS_Controller
{
	public function __construct()
    {
		parent::__construct();
        $this->load->model('faculty_user_model');
	}

    public function profile()
    {
        $data = array(
        'page_title' => 'Admin Panel',
        );
        $this->setup_view('admin/dashboard', $data);
    }

    public function document()
    {
        $data = array(
            'page_title'=> 'Browse Documents'
        );
        $this->setup_view('document/view', $data);

    }

    public function faculty()
    {
        $data = array(
            'page_title'=> 'Manage Members'
        );
        $this->setup_view('faculty/search', $data);
    }

    public function register()
    {
        $id      = intval($this->faculty_user_model->getMaxMemberID()) + 1;
        $user    = $this->input->post('reg_username');
        $pass   = $this->input->post('reg_password');
        $conPass   = $this->input->post('reg_con_password');
        $fname   = $this->input->post('edit_fname');
        $mname   = $this->input->post('edit_mname');
        $lname   = $this->input->post('edit_lname');
        $bday    = $this->input->post('edit_birthdate');
        $address = $this->input->post('edit_address');
        $status  = $this->input->post('edit_status');
        $degree  = $this->input->post('edit_degree');
        $rank    = $this->input->post('edit_rank');
        $dept    = $this->input->post('edit_department');
        $specs   = $this->input->post('edit_special');

        /*$this->setup_view('test',
        array(
            'id' => $id,
        'user' => $user,
        'pass' => $pass,
        'conPass' => $conPass,
        'fname' => $fname,
        'mname' => $mname,
        'lname' => $lname,
        'bday' => $bday,
        'address' => $address,
        'status' => $status,
        'degree'  => $degree,
        'rank'    => $rank,
        'dept'    => $dept,
        'specs'   => $specs
        ));*/


        if (strcmp ( $pass , $conPass ) == 0)
        {
            $this->faculty_user_model->addMember($id, $user, $pass, $status, 1);
            $this->faculty_user_model->addMemberProfile
                (intval($id)+1, $rank, $degree, $specs, $dept, $fname, $mname, $lname, $bday, $address);
        }


        $this->faculty();


    }

}

/* End of file fmis.php */
/* Location: ./application/controllers/fmis.php */